﻿using MaterialDemo.DataEntity;
using MaterialDemo.DataEntity.Entities;
using MaterialDemo.IService.IGoods_Category;
using MaterialDemo.Model.Goods_CategoryDTO;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MaterialDemo.Service.Goods_Category
{
    public class Goods_CategoryService : IGoods_CategoryService
    {

        #region 构造函数注入    
        private readonly ILogger<Goods_CategoryService> _logger;

        private readonly DbContext _dbContext;
        public Goods_CategoryService(ILogger<Goods_CategoryService> logger, DbContext dbContext)
        //: base(dbContext)
        {
            _logger = logger;
            _dbContext = dbContext;

        }


        #endregion
        public List<Goods_CategoryOutput> GetList()
        {
            return (from a in _dbContext.Set<GoodsCategory>()
                   select new Goods_CategoryOutput
                   {
                     Id=a.Id,
                     CategoryName=a.CategoryName,
                     Description=a.Description,
                   }).ToList();
        }
    }
}
